<template>
	<view class="page">
		<!-- 蓝色背景区域 -->
		<view class="blue-background"></view>
		
		<!-- 主内容容器 -->
		<view class="main-content">
			<!-- 优惠团购列表 -->
			<view class="group-buy-list">
				<view class="group-buy-item" v-for="(item, index) in groupBuyList" :key="index" @click="navigateToDetail(item, index)">
					<!-- 图片区域 -->
					<view class="image-container">
						<image class="group-buy-image" :src="item.image" mode="aspectFill"></image>
					</view>
					<!-- 文字内容区域 -->
					<view class="text-content">
						<view class="content-row">
							<text class="description-text">{{ item.description }}</text>
							<text class="detail-link">{{ item.detail }}</text>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				groupBuyList: [
					{ 
						image: "/static/images/xtx/优惠团购1.png", 
						title: "优惠券", 
						subtitle: "免费发放活动进行中...",
						description: "汽车惠民活动走进.......",
						detail: "详情 >"
					},
					{ 
						image: "/static/images/xtx/优惠团购2.jpg", 
						title: "清凉一夏与沃同享", 
						subtitle: "沃尔沃东区夏日主题购车节",
						description: "汽车惠民活动走进.......",
						detail: "详情 >"
					}
				]
			}
		},
		methods: {
			// 跳转到详情页面
			navigateToDetail(item, index) {
				uni.navigateTo({
					url: '/pages/group_purchase/detail/detail?index=' + index + '&item=' + encodeURIComponent(JSON.stringify(item))
				});
			}
		}
	}
</script>

<style>
	.page {
		background-color: #f5f6fa;
		min-height: 100vh;
		position: relative;
	}
	
	/* 蓝色背景区域 */
	.blue-background {
		position: absolute;
		top: 0;
		left: 0;
		width: 100%;
		height: 300rpx;
		background: linear-gradient(120deg, #3385fd 0%, #3385fd 100%);
	}
	
	/* 主内容容器 */
	.main-content {
		position: absolute;
		top: 1rpx;
		left: 50%;
		transform: translateX(-50%);
		width: 94%;
		max-width: 750rpx;
		z-index: 10;
		padding: 20rpx 0;

	}
	
	/* 优惠团购列表 */
	.group-buy-list {
		display: flex;
		flex-direction: column;
		gap: 30rpx;
	}
	
	/* 团购项 */
	.group-buy-item {
		background: #ffffff;
		border-radius: 20rpx;
		box-shadow: 0 4rpx 20rpx rgba(0,0,0,0.1);
		overflow: hidden;
		margin-bottom: 30rpx;
		cursor: pointer;
		transition: transform 0.2s ease;
	}
	
	.group-buy-item:active {
		transform: scale(0.98);
	}
	
	/* 图片容器 */
	.image-container {
		position: relative;
		width: 90%;
		height: 350rpx;
		margin: 20rpx auto 0;
	}
	
	/* 团购图片 */
	.group-buy-image {
		margin-top: 10rpx;
		width: 100%;
		height: 100%;
		border-radius: 15rpx;
	}
	
	
	/* 文字内容区域 */
	.text-content {
		padding: 20rpx 30rpx;
		min-height: 50rpx;
		display: flex;
		align-items: center;
		background: #ffffff;
	}
	
	/* 内容行 */
	.content-row {
		display: flex;
		justify-content: space-between;
		align-items: center;
		width: 100%;
	}
	
	/* 描述文字 */
	.description-text {
		font-size: 28rpx;
		color: #666666;
		flex: 1;
		line-height: 1.5;
	}
	
	/* 详情链接 */
	.detail-link {
		font-size: 24rpx;
		color: #999999;
		margin-left: 20rpx;
	}
</style>